﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class magazine : items
    {
        public string Izd; //назване издетельства
        public int PCount; //количетсво траниц        
        public override string SaveToCSV()
        {
            string str;
            str = "Magazine" + ';' + id.ToString() + ';' + PCount.ToString() + ';' + Izd + ';' + CopyCount.ToString() + ';' + Cost.ToString();
            return str;
        }
        public override void LoadFromCSV(string[] p)
        {
            id = Int32.Parse(p[1]);
            PCount = Int32.Parse(p[2]);
            Izd = p[3];
            CopyCount = Int32.Parse(p[4]);
            Cost = Double.Parse(p[5]);
        }
        public override void LoadFromXML(string[] p)
        {
            id = Int32.Parse(p[6]);
            PCount = Int32.Parse(p[10]);
            Izd = p[14];
            CopyCount = Int32.Parse(p[18]);
            Cost = Double.Parse(p[22]);
        }
        public override string SaveToXML()
        {
            string str;
            str = "<item class=" + '"' + "Magazine" + '"' + "><Id>" + id.ToString() + "</Id><PCount>" + PCount.ToString() + "</PCount><Izd>" + Izd + "</Izd><CopyCount>" + CopyCount.ToString() + "</CopyCount><Cost>" + Cost.ToString() + "</Cost></item>";
            return str;
        }
        public override string SaveToJSON()
        {
            string str;
            str = @"{""Magazine:""{ ""id"":" + this.id + @",""PCount"":" + this.PCount + @",""Izd"":""" + this.Izd + @""",""CopyCount"":" + this.CopyCount + @",""Cost"":" + this.Cost + @"}}";
            return str;
        }
        public override void LoadFromJSON(string[] p)
        {
            id = Int32.Parse(p[6]);
            PCount = Int32.Parse(p[10]);
            Izd = p[16];
            CopyCount = Int32.Parse(p[20]);
            Cost = Double.Parse(p[24]);
        }
        public override string SaveToYAML()
        {
            string str;
            str = @"Magazine:{id:" + this.id + @",PredC:" + this.PCount + @",Author:" + this.Izd + @",CopyCount:" + this.CopyCount + @",Cost:" + this.Cost + @"}";
            return str;
        }
        public override void LoadFromYAML(string[] p)
        {
            id = Int32.Parse(p[3]);
            PCount = Int32.Parse(p[5]);
            Izd = p[7];
            CopyCount = Int32.Parse(p[9]);
            Cost = Double.Parse(p[11]);
        }
    }
}
